<?PHP
require_once('customerClass.php');
$DEBUG = false;

/* Setup the VARS first off from the URL String. Sent either via LSL or via HTTP */
// using _GET instead of _POST. as I cant say the variables are POSTED on a HTTP GET request. it may break the LSL. 

$firstname = $_POST["first"];
$key = $_POST["uuid"];
$lastname = $_POST["last"];
$DO = $_POST["do"];

if ($DEBUG) {
echo "running with variables:<br> &nbsp;&nbsp;&nbsp;&nbsp;Key:" . $key;
echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;First:" . $firstname;
echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;Last:" . $lastname;
echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;Operation:" . $DO;
echo "<p>";
}


// Now lets do data functions with the user data, identified by their UUID. so far just checking for working methods.
// once all teh methods have been written and function properly, it will be dynamic based on what the variable DO =,
// eg: if DO=Add THEN $customer1->customerRegister(), or if DO=Delete THEN $customer1->CustomerDelete().

// Start up an instance of the Customer Class and assign the variables we want to do manipulation with.
$Customer1 = new Customer();
$Customer1->setVars($key,$firstname,$lastname);

switch ($DO) {
    case "delete" :
        $result = $Customer1->customerRemove();
        echo $result;
        break;
    case "register" :
        $result = $Customer1->customerRegister();
        echo $result;
        break;
    case "list" :
        $result = $Customer1->displayUserListPlainText();
        break;
    case "locate" :
        $result = $Customer1->checkUserExistance();
        break;
    default :
        echo "missing_operator";
        break;
}
        
    




?>

